minetest.register_node("randomchests:dummy", {
	description = "Mine Air (you hacker you!)",
	inventory_image = "unknown_node.png",
	wield_image = "unknown_node.png",
	drawtype = "airlike",
	paramtype = "light",
	sunlight_propagates = true,
	walkable = false,
	pointable = false,
	diggable = false,
	buildable_to = true,
	air_equivalent = true,
	drop = "",
	groups = {not_in_creative_inventory=1},
})

-- get node content ids
local c_air = minetest.get_content_id("air")
local c_fence = minetest.get_content_id("default:fence_wood")
local c_wood = minetest.get_content_id("default:wood")
local c_water = minetest.get_content_id("default:water_source")
local c_dummy = minetest.get_content_id("randomchests:dummy")

local chest_stuff = {
	{name="default:apple", max = 3},
	{name="farming:bread", max = 3},
	{name="default:steel_ingot", max = 2},
	{name="default:gold_ingot", max = 2},
	{name="default:diamond", max = 1},
	{name="default:pick_steel", max = 1},
	{name="default:pick_diamond", max = 1}
}

local function fill_chest(pos)
	minetest.after(5, function()
		local n = minetest.get_node(pos)
		if n ~= nil then
			if n.name == "randomchests:dummy" then
				minetest.set_node(pos, {name="default:chest"})
				local meta = minetest.get_meta(pos)
				--meta:set_string("formspec",default.chest_formspec)
				--meta:set_string("infotext", "Chest")
				local inv = meta:get_inventory()
				inv:set_size("main", 8*4)
				for i=0,2,1 do
					local stuff = chest_stuff[math.random(1,#chest_stuff)]
					local stack = {name=stuff.name, count = math.random(1,stuff.max)}
					if not inv:contains_item("main", stack) then
						inv:set_stack("main", math.random(1,32), stack)
					end
				end
			end
		end
	end)
end
